home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / GNU / emacs_client.lha / emacs.rexx < prev   
Encoding:
OS/2 REXX Batch file  |  1993-06-03  |  1.1 KB  |  54 lines

  1. /* emacs.rexx - GNU Emacs client         */
  2. /* by Elad Tsur Email: elad@math.tau.ac.il     */
  3.  
  4. OPTIONS FAILAT 21
  5. exitcode = 0
  6. PARSE ARG line
  7.  
  8. IF SHOW('P','EMACS1') THEN
  9.     DO       /* we need to parse the command line */
  10.     DO i=1
  11.         PARSE VAR line prefix '"' filename '"' postfix
  12.         line = prefix||postfix
  13.         IF filename = '' THEN LEAVE
  14.         file.i = filename
  15.     END
  16.     DO WHILE line ~= ''
  17.         PARSE VAR line filename line
  18.         file.i = filename
  19.         i = i + 1
  20.     END
  21.     cd = PRAGMA('D') /* add the current directory to relative paths */
  22.     IF RIGHT(cd,1) ~= ":" THEN
  23.         cd = cd||'/'
  24.     DO j=1 TO i-1
  25.         IF POS(':',file.j) = 0 THEN
  26.         file.j = cd||file.j
  27.         ADDRESS 'EMACS1' '(find-file "'||file.j||'")'
  28.         IF RC ~= 0 THEN
  29.         DO
  30.             SAY "emacs: can't open file "||file.j
  31.             exitcode =5
  32.         END
  33.     END
  34.     END
  35.  
  36. ELSE      /* we need to start emacs... */
  37.     DO
  38.     oldstack = PRAGMA('S',50000) /* emacs need large stack */
  39.     oldpri = PRAGMA('P',1)
  40.     ADDRESS COMMAND "Run <NIL: >NIL: GNUEMACS:temacs "||line
  41.     IF RC ~= 0 THEN
  42.         DO
  43.         SAY "emacs: can't run GNUEMACS:temacs RC= "||RC
  44.         exitcode = 20
  45.         END
  46.     CALL PRAGMA('S',oldstack)
  47.     CALL PRAGMA('P',oldpri)
  48.     END
  49.  
  50. EXIT exitcode
  51.  
  52.     
  53.         
  54.